-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: correctly check URL pathname with Cloudflare adapter #8733
fix: correctly check URL pathname with Cloudflare adapter #8733
Conversation
🦋 Changeset detectedLatest commit: 84de0dd The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
const filename = stripped_pathname.substring(1); | ||
if (filename) { | ||
is_asset = manifest.assets.has(filename) || manifest.assets.has(filename + '/index.html'); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could there theoretically be an asset named index.html
? What was the reason for changing this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could there theoretically be an asset named index.html?
If a dev decides to include one in /static
I suppose. It helps if someone navigates to that route.
This check was already there previously, but I suppose it's good to have it since the worker has to handle all file routing.
What was the reason for changing this?
I thought it would be a small optimisation, although I'm unsure if it has an impact.
If the url is https://test.com/
, then the resulting filename would be ''
. This addition helps skip the manifest check for an empty string.
Co-authored-by: Rich Harris <hello@rich-harris.dev>
fixes #8708
fixes #8736
I noticed a discrepancy where trailing slashes would be removed before checking if the file exists in
manifest.prerendered
.This caused the pages with trailing slashes to never be found in the manifest.
Hopefully this fixes the issue for prerendered trailing slash pages that go through the Cloudflare worker.
Pages that manage to fit in the 100 rule limit for
_routes.json
do not go through the worker so they don't have this issue.EDIT: expanded the scope of the PR to fix the URI encoding issue mismatch as well. It used to check the encoded pathname against the decoded paths in the manifest.
Please don't delete this checklist! Before submitting the PR, please make sure you do the following:
Tests
pnpm test
and lint the project withpnpm lint
andpnpm check
Changesets
pnpm changeset
and following the prompts. Changesets that add features should beminor
and those that fix bugs should bepatch
. Please prefix changeset messages withfeat:
,fix:
, orchore:
.